import {createRouter,createWebHashHistory} from 'vue-router'

import dashboard from '../pages/dashboard/Index.vue'
import Layout from "../pages/Layout.vue";
import user from '../pages/user/userManger.vue';
import music from '../pages/music/index.vue'
import artist from '../pages/artist/index.vue'
import playlist from '../pages/playlist/index.vue'
export const menuRoutes=[
    {
        path: 'dashboard',
        name: 'Dashboard',
        meta:{title:"控制台",icon:"dashboard"},
        component:dashboard
    },
    {
        path: 'user',
        name: 'User',
        meta:{title:"用户管理",icon:"manage_accounts"},
        component:user
    },
    {
        path: 'music',
        name: 'music',
        meta:{title:"歌曲管理",icon:"music_note"},
        component:music
    },
    {
        path: 'artist',
        name: 'artist',
        meta:{title:"歌手管理",icon:"mic"},
        component:artist
    },
    {
        path:'playlist',
        name:'playlist',
        meta:{title:"歌单管理",icon:'queue_music'},
        component: playlist
    }
];


const routes=[
    {
        path: '/',
        component: Layout,
        redirect:'dashboard',
        children:menuRoutes
    },

    {
        path: '/login',
        component: ()=>import('../pages/Login.vue')
    },
    {
        path: '/403',
        component: ()=>import('../pages/403.vue')
    },
    {
        path: '/:pathMatch(.*)',  //vue3的404写法
        component: ()=>import('../pages/404.vue')
    }

]

const router=createRouter({
    history: createWebHashHistory(),
    routes,
})

export default router